<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <%@include file="/res/include/base-head.jsp"%>
	<%@include file="/res/include/jquery-easyui.jsp"%>
	<%@include file="/res/include/umeditor.jsp"%>
	<script type="text/javascript" src="${pageContext.request.contextPath}/res/js/delivery/sysdict.js"></script>
  </head>
  <body>  
<div class="page_title clearfix">
    <h2>
    <c:if test="${!empty entity}">
    	编辑
    </c:if>
    <c:if test="${empty entity}">
    	新建
    </c:if>
    </h2>
</div>
<div class="form_item topic_add">
   <form id="data-form">
   	<c:if test="${!empty entity}">
    	<input type="hidden" name="id" value="${entity.id }"/>
    </c:if>
    <dl>
        <dt>类型：</dt>
        <dd><input type="text" name="type" value="${entity.type }" class="txt grid-25 easyui-validatebox" data-options="required:true" maxlength="32"/></dd>
    </dl>
    <dl>
        <dt>类型名称：</dt>
        <dd><input type="text" name="typeDesc" value="${entity.typeDesc }" class="txt grid-25 easyui-validatebox" data-options="required:true" maxlength="32"/></dd>
    </dl>
    <dl>
        <dt>名称：</dt>
        <dd><input type="text" name="name" value="${entity.name }" class="txt grid-25 easyui-validatebox" data-options="required:true" maxlength="32"/></dd>
    </dl>
    <dl>
        <dt>字典code值：</dt>
        <dd><input type="text" name="code" value="${entity.code }" class="txt grid-25 easyui-validatebox" data-options="required:true" maxlength="32"/></dd>
    </dl>
    <dl>
        <dt>备注：</dt>
        <dd><input type="text" name="remark" value="${entity.remark }" class="txt grid-25"  maxlength="32"/></dd>
    </dl>
    <dl>
        <dt>排序：</dt>
        <dd><input type="text" name="oidx" value="${entity.oidx }" class="txt grid-25"  maxlength="32"/></dd>
    </dl>
    </form>
    <p class="page_btn" id="showBtn"><input type="button" id="doSave" value="保存" class="btn_blue" onclick="doSave();"/></p>
</div>
<script type="text/javascript">
var qlevel = 1;

$(document).ready(function() {
});

var isSave = false;
//提交保存
function doSave(){
	var url = contextPath+'/delivery/sys/dict/add';
	<c:if test="${!empty entity}">
		url = contextPath+'/delivery/sys/dict/update';
	</c:if>
	if(!$('#data-form').form('validate')) return;
	if (isSave) {
		return;
	}
	isSave = true;
	var data = $('#data-form').form('jsonObject');
	//console.info("------------:"+JSON.stringify(data));
	$.post(url,data,function(result) {
		if(result.code==1) {
			top.showInfo('保存成功');
		} else {
			isSave = false;
			top.showInfo('保存失败:'+result.msg);
		}
	},'json');
}
</script>
  </body>
</html>
